package com.tonann.app.service.impl;

import com.tonann.app.domain.AppOneKeyRepair;
import com.tonann.app.mapper.AppOneKeyRepairMapper;
import com.tonann.app.service.IAppOneKeyRepairService;
import com.tonann.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 一键报修Service业务层处理
 *
 * @author tonann
 * @date 2023-05-25
 */
@Service
public class AppOneKeyRepairServiceImpl implements IAppOneKeyRepairService {
    @Autowired
    private AppOneKeyRepairMapper appOneKeyRepairMapper;

    /**
     * 查询一键报修
     *
     * @param id 一键报修主键
     * @return 一键报修
     */
    @Override
    public AppOneKeyRepair selectAppOneKeyRepairById(Long id) {
        return appOneKeyRepairMapper.selectAppOneKeyRepairById(id);
    }

    /**
     * 查询一键报修列表
     *
     * @param appOneKeyRepair 一键报修
     * @return 一键报修
     */
    @Override
    public List<AppOneKeyRepair> selectAppOneKeyRepairList(AppOneKeyRepair appOneKeyRepair) {
        return appOneKeyRepairMapper.selectAppOneKeyRepairList(appOneKeyRepair);
    }

    /**
     * 新增一键报修
     *
     * @param appOneKeyRepair 一键报修
     * @return 结果
     */
    @Override
    public int insertAppOneKeyRepair(AppOneKeyRepair appOneKeyRepair) {
        appOneKeyRepair.setCreateTime(DateUtils.getNowDate());
        return appOneKeyRepairMapper.insertAppOneKeyRepair(appOneKeyRepair);
    }

    /**
     * 修改一键报修
     *
     * @param appOneKeyRepair 一键报修
     * @return 结果
     */
    @Override
    public int updateAppOneKeyRepair(AppOneKeyRepair appOneKeyRepair) {
        appOneKeyRepair.setUpdateTime(DateUtils.getNowDate());
        return appOneKeyRepairMapper.updateAppOneKeyRepair(appOneKeyRepair);
    }

    /**
     * 批量删除一键报修
     *
     * @param ids 需要删除的一键报修主键
     * @return 结果
     */
    @Override
    public int deleteAppOneKeyRepairByIds(Long[] ids) {
        return appOneKeyRepairMapper.deleteAppOneKeyRepairByIds(ids);
    }

    /**
     * 删除一键报修信息
     *
     * @param id 一键报修主键
     * @return 结果
     */
    @Override
    public int deleteAppOneKeyRepairById(Long id) {
        return appOneKeyRepairMapper.deleteAppOneKeyRepairById(id);
    }
}
